const rl = require('readline').createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
    console.log('please enter arrays');
    while ((line = await readline())) {
        console.log(`line is ${line}`);

        if (line == '0') {
            // console.log(`close readline`);
            rl.close();
            break;
        }

        let tokens = line.split(' ').map((ele) => parseInt(ele));
        tokens.shift();

        console.log(tokens);

        const count = tokens.reduce((acc, cur) => acc + cur, 0);

        console.log(count);
    }
})();

/**
 * 输入例子：
4 1 2 3 4
5 1 2 3 4 5
0
输出例子：
10
15
 */
